import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase="DBshop006_销售管理处理退货流程"
firefox=openBrowser(urlAdmin) #调用函数打开网址
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'销售管理','退货管理')
rootPath=get_pro_rootpath() #获取项目的绝对路径
filePath=rootPath+r'\public\order1.txt' #拼接文件路径
orderNo=readFile(filePath) #读取文件中的订单编号
firefox.find_element_by_name('order_sn').send_keys(orderNo)
firefox.find_element_by_xpath('//button').click()
firefox.find_element_by_link_text("处理退货").click()
firefox.find_element_by_id('refund_price').clear()
firefox.find_element_by_id('refund_price').send_keys(3558)
firefox.find_element_by_xpath('//button').click()
firefox.find_element_by_link_text('查看详情').click()
time.sleep(3)
s=firefox.find_element_by_xpath('//body').text
l='\('
r='\)'
order_State=reGetString(s,l,r)
print(order_State) #order_State 是实际值
yuqi="退款成功"  #这是预期值
#检查点
if yuqi==order_State:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
firefox.quit()